import {
    center,
    right,
    grid,
    input,
    button,
    search,
    header,
} from '@/css/DialogsCss.module.scss';
export default {
    title:'联系人',
    dialog:{
        size:'50%'
    },
    onMounted: [{
        action: 'set',
        target: '$widgets.form',
        field: 'value',
        value: '$params'
    }],
    items: [{
        region: 'center',
        span: 10,
        class: center,
        layout: 'vertical',
        items: [{
            layout: 'vertical',
            items: [{
                id: 'form',
                widget: 'form',
                layout: {
                    type:'gridform',
                    column:2
                },
                fields:[{
                    itemId:'customer_uuid',
                    placeholder:'请选择关联客户(公司)',
                    widget:'select',
                    onMounted:[{
                        action:'service',
                        path:'public/customer',
                        actions:[{
                            action:'set',
                            target:'$widget',
                            field:'options',
                            value:'$params.data'
                        }]
                    }],
                    label:'客户(公司)',
                },{
                    class: input,
                    itemId: 'name',
                    placeholder:'请输入联系人',
                    widget:'text',
                    label:'联系人',
                },{
                    class: input,
                    itemId: 'gender',
                    widget:'radiogroup',
                    label:'性别',
                    options:[{
                        value:0,
                        text:'未知'
                    },{
                        value:1,
                        text:'男'
                    },{
                        value:2,
                        text:'女'
                    }],
                },{
                    class: input,
                    itemId: 'position',
                    placeholder:'请输入职位',
                    widget:'text',
                    label:'职位名称',
                },{
                    class: input,
                    itemId: 'phone',
                    placeholder:'请输入手机号码',
                    widget:'text',
                    label:'手机号码',
                },{
                    class: input,
                    itemId: 'tel',
                    placeholder:'请输入座机',
                    widget:'text',
                    label:'座机号码',
                },{
                    class: input,
                    itemId: 'qq',
                    placeholder:'请输入QQ',
                    widget:'text',
                    label:'Q Q号码',
                },{
                    class: input,
                    itemId: 'wechat',
                    placeholder:'请输入微信',
                    widget:'text',
                    label:'微信号码',
                },{
                    itemId: 'last_follow_time',
                    placeholder:'请选择最后跟进时间',
                    widget:'form-datepicker',
                    type: 'date',
                    label:'最后跟进',
                },{
                    class: input,
                    itemId: 'remarks',
                    placeholder:'请输入备注说明',
                    widget:'text',
                    label:'备注说明',
                }],
                buttons: [{
                    value: '保存',
                    type: 'primary',
                    onClick: [{
                        action: 'confirm',
                        title: '表单保存',
                        message: '是否保存表单?',
                        confirm: [{
                            action: 'service',
                            path: 'customer/contacts/save',
                            params: '$widget.value'
                        }, {
                            action: 'message',
                            message: '保存成功',
                            type: 'success'
                        }, {
                            action: 'service',
                            path: 'customer/contacts/list',
                            params:{
                                page_size:'$widgets.grid.pageSize',
                                page_no:'$widgets.grid.page',
                                keywords: '$widgets.search.value.keywords',
                                is_show: '$widgets.search.value.is_show',
                            },
                            actions: [{
                                action:'set',
                                target:'$widgets.grid',
                                field:'value',
                                value:'$params.data.items'
                            },{
                                action:'set',
                                target:'$widgets.grid',
                                field:'total',
                                value:'$params.data.total'
                            }]
                        },{
                            action:'dialog-hide',
                            mode:'apply'
                        }]
                    }]
                }],
                flex: true
            }]
        }]
    }]
};


